*REPLICATION DO FILE

*This file replicates the analysis included in:
*Title of the paper: "When campaigns can backfire. National identities and support for parties in the 2015 UK general election in Scotland"
*Author: Davide Morisi
*Journal: Political Research Quarterly

*Date: March 20, 2018


set more off
ssc install fre

**************************
/// EXPERIMENTAL STUDY

*Dataset: "Experiment_dataset_Morisi_PRQ.dta"
*Note: Experimental study conducted online with participants recruited by BLUE Lab, University of Edinburgh
*Period of the experiment: from April 22 to May 2, 2015 


**************
*RECODING

*likeability scores from 0 to 1
gen like_con01 = like_con/10 if like_con!=11
gen like_lib01 = like_lib/10 if like_lib!=11
gen like_lab01 = like_lab/10 if like_lab!=11
gen like_snp01 = like_snp/10 if like_snp!=11
label define like01 0"Strongly dislike" 1"Strongly like"
label values like_con01 like01
label values like_lib01 like01
label values like_lab01 like01
label values like_snp01 like01

*vote - 4 main parties
recode voteint (5/11=.), gen(vote4)
label values vote4 vote
ta vote4

*national identity
fre identity
recode identity (1/3=2 "Scottish") (4/5=1 "British") (6=.), gen(id_britscot)
fre id_britscot

*party id - 4 main parties
recode partyid (5/99=0), gen(partyid4)
label de partyid 0"Other party/no party", modify
label values partyid4 partyid
ta partyid4


*************
*TABLES AND FIGURES

*Table 1. The effect of attack statements on party likeability 
*Models 1-4 (no interactions)
reg like_con01 i.group i.partyid4
reg like_lib01 i.group i.partyid4
reg like_lab01 i.group i.partyid4
reg like_snp01 i.group i.partyid4
*Models 5-8 (interactions)
reg like_con01 i.group##i.id_britscot i.partyid4
reg like_lib01 i.group##i.id_britscot i.partyid4
reg like_lab01 i.group##i.id_britscot i.partyid4
reg like_snp01 i.group##i.id_britscot i.partyid4


*Table 2. The effect of attack statements on voting intentions
mlogit vote4 i.group##id_britscot, b(4)
mlogit vote4 i.group##id_britscot i.partyid4, b(4)


*Figure 1. Support for parties by control and treatment groups and by identity categories
*all respondents
cibar like_con01, over1(group) level(90) graphopt(name(con_all))
cibar like_lib01, over1(group) level(90) graphopt(name(lib_all))
cibar like_lab01, over1(group) level(90) graphopt(name(lab_all))
cibar like_snp01, over1(group) level(90) graphopt(name(snp_all))
*british identify
cibar like_con01 if id_britscot==1, over1(group) level(90) graphopt(name(con_brit))
cibar like_lib01 if id_britscot==1, over1(group) level(90) graphopt(name(lib_brit))
cibar like_lab01 if id_britscot==1, over1(group) level(90) graphopt(name(lab_brit))
cibar like_snp01 if id_britscot==1, over1(group) level(90) graphopt(name(snp_brit))
*scottish identity
cibar like_con01 if id_britscot==2, over1(group) level(90) graphopt(name(con_scot))
cibar like_lib01 if id_britscot==2, over1(group) level(90) graphopt(name(lib_scot))
cibar like_lab01 if id_britscot==2, over1(group) level(90) graphopt(name(lab_scot))
cibar like_snp01 if id_britscot==2, over1(group) level(90) graphopt(name(snp_scot))
*combined
graph combine con_all lib_all lab_all snp_all ///
	con_brit lib_brit lab_brit snp_brit ///
	con_scot lib_scot lab_scot snp_scot 
	

*Figure 2. Average marginal effects of attack statements on likeability of Labour party
reg like_lab01 i.group##i.id_britscot i.partyid4
margins id_britscot, dydx(group) level(90)
marginsplot, yline(0)


*Figure 3A. Effects of attack statements on voting for Labour and SNP
mlogit vote4 i.group##id_britscot i.partyid4, b(4)
margins id_britscot, dydx(group) predict(outcome(3)) level(90)
marginsplot, yline(0) name(labEXP)
margins id_britscot, dydx(group) predict(outcome(4)) level(90)
marginsplot, yline(0) name(snpEXP)


***********
*APPENDIX

*Table A1. Support for parties by groups and identity categories
*all respondents
ttest like_con01, by(group)
ttest like_lib01, by(group)
ttest like_lab01, by(group)
ttest like_snp01, by(group)
*british
ttest like_con01 if id_britscot==1, by(group)
ttest like_lib01 if id_britscot==1, by(group)
ttest like_lab01 if id_britscot==1, by(group)
ttest like_snp01 if id_britscot==1, by(group)
*scottish
ttest like_con01 if id_britscot==2, by(group)
ttest like_lib01 if id_britscot==2, by(group)
ttest like_lab01 if id_britscot==2, by(group)
ttest like_snp01 if id_britscot==2, by(group)


*Table A2. The effect of attack statemtns on party ‘rating gap’
*recoding
gen like_conlib = like_con01-like_lib01
gen like_conlab = like_con01-like_lab01
gen like_consnp = like_con01-like_snp01
gen like_liblab = like_lib01-like_lab01
gen like_libsnp = like_lib01-like_snp01
gen like_labsnp = like_lab01-like_snp01
gen like_othersnp = ((like_con01+like_lib01+like_lab01)/3)-like_snp01
*analysis
reg like_conlib i.group##i.id_britscot i.partyid4
reg like_conlab i.group##i.id_britscot i.partyid4
reg like_consnp i.group##i.id_britscot i.partyid4
reg like_liblab i.group##i.id_britscot i.partyid4
reg like_libsnp i.group##i.id_britscot i.partyid4
reg like_labsnp i.group##i.id_britscot i.partyid4
reg like_othersnp i.group##i.id_britscot i.partyid4



***************************
***************************
/// BRITISH ELECTION STUDY INTERNET PANEL - Combined Wave 1-6
 
*Authors: Fieldhouse, E., J. Green, G. Evans, C. Van der Eijk, H. Schmitt, J. Mellon, and C. Prosser (2015). The British Election Study Internet Panel 2014-2015
*Dataset: BES Internet Panel Waves 1-6, availablet at http://www.britishelectionstudy.com/data-objects/panel-study-data/
*Further information on the dataset available at: http://dx.doi.org/10.15127/1.293723


***********
*RECODING

*Weight
egen totwt = sum(wt_full_W6), by(country)
egen totpop = count(wt_full_W6), by(country)
gen scaling = totpop /totwt
gen regwt= scaling * wt_full_W6
drop scaling totwt totpop

*Vote
fre generalElectionVoteW6
recode generalElectionVoteW6 (5/9999=.), gen(vote4)
label values vote4 generalElecVote
tab vote4

*Perceived negativity
*conservatives
gen conToneW5rev = (-conToneW5+5)/4 if conToneW5!=9999
label define neg 0 "positive" 1 "negative"
label variable conToneW5rev "Perceived campaign tone of Conservative"
label values conToneW5rev neg
ta conToneW5rev
*labour
gen labToneW5rev = (-labToneW5+5)/4 if labToneW5!=9999
label variable labToneW5rev "Perceived campaign tone of Labour"
label values labToneW5rev neg
ta labToneW5rev
*lib dem
gen ldToneW5rev = (-ldToneW5+5)/4 if ldToneW5!=9999
label variable ldToneW5rev "Perceived campaign tone of Lib Dem"
label values ldToneW5rev neg
ta ldToneW5rev
*snp
gen snpToneW5rev = (-snpToneW5+5)/4 if snpToneW5!=9999
label variable snpToneW5rev "Perceived campaign tone of SNP"
label values snpToneW5rev neg
ta snpToneW5rev
*combined
gen perc_neg = (conToneW5rev+labToneW5rev+ldToneW5rev+snpToneW5rev)/4
label variable perc_neg "Perceived tone of campaign"
label values perc_neg neg
ta perc_neg

*British/Scottish identity
gen id_britscotfull = scottishnessW4-britishnessW4 if(scottishnessW4!=9999 & britishnessW4!=9999)
recode id_britscotfull (-6/-1=1 "British") (0/6=2 "Scottish"), gen(id_britscot)
label variable id_britscot "British/Scottish identity"
fre id_britscot

*Party id
fre partyIdW4
recode partyIdW4 (1=1 "Conservative") (2=2 "Labour") (3=3 "Lib Dem") (4=4 "SNP") (5/9999=0 "Other party/No party"), gen(partyid4)
ta partyid4

*Scottish ref voting intention
fre scotReferendumIntentionW4
recode scotReferendumIntentionW4 (1=1 "Vote Yes") (else=0 "Other option"), gen(yesref)
label var yesref "Intention to vote Yes at future Scottish referendum"
tab yesref 

*Trust in MPs
fre trustMPsW4
gen trustMPsW4r = (trustMPsW4-1)/6 if trustMPsW4!=9999
label var trustMPsW4r "Trust in MPs in general"
label de trust 0"No trust" 1"A great deal of trust"
label values trustMPsW4r trust
ta trustMPsW4r

*Approval of Scottish government
fre approveScotGovtW4
gen approveScotGovtW4r = (approveScotGovtW4-1)/4 if approveScotGovtW4!=9999
label var approveScotGovtW4r "Approval of Scottish government"
label de approveScotGovtW4r 0"Strongly disapprove" 1"Strongly approve"
label values approveScotGovtW4r approveScotGovtW4r
tab approveScotGovtW4r

*Performance of future Labour government
fre changeEconomyLabW4r1
fre changeEconomyLabW4
gen changeEconomyLabW4r = (changeEconomyLabW4-1)/4 if changeEconomyLabW4!=9999
tab changeEconomyLabW4r

*Interest in elections:
fre electionInterestW5
gen electionInterestW5r = (electionInterestW5-1)/3 if electionInterestW5!=9999
label var electionInterestW5r "Interest in elections"
label de electionInterestW5r 0"Not all interested" 1"Very interested"
label values electionInterestW5r electionInterestW5r
ta electionInterestW5r


*************
*TABLES AND FIGURES

global covariates = "yesref trustMPsW4r approveScotGovtW4r changeEconomyLabW4r electionInterestW5r"

*Table 3. Perceived negativity and vote (BES Internet Panel)
mlogit vote4 c.perc_neg##i.id_britscot i.partyid4 if country==2 [iweight=regwt], b(4)
mlogit vote4 c.perc_neg##i.id_britscot i.partyid4 $covariates if country==2 [iweight=regwt], b(4)


*Figure 3B. Effects of perceived negativity on voting for Labour and SNP by national identity
mlogit vote4 c.perc_neg##i.id_britscot i.partyid4 $covariates if country==2 [iweight=regwt], b(4)
margins id_britscot, dydx(perc_neg) predict(outcome(2)) level(90)
marginsplot, yline(0) name(labBES)
margins id_britscot, dydx(perc_neg) predict(outcome(4)) level(90)
marginsplot, yline(0) name(snpBES)
graph combine labBES snpBES
*Figure 3 - EXP + BES combined
graph combine labEXP snpEXP labBES snpBES


***********
*APPENDIX


*Table A3. Perceived campaign tone
gen sample = 1 if (conToneW5rev!=. & ldToneW5rev!=. & labToneW5rev!=. & snpToneW5rev!=. & country==2)
*all respondents
sum conToneW5rev if sample==1 [iweight=regwt] 
sum ldToneW5rev if sample==1 [iweight=regwt] 
sum labToneW5rev if sample==1 [iweight=regwt] 
sum snpToneW5rev if sample==1 [iweight=regwt] 
*all respondents weighted by party id
sum conToneW5rev if sample==1 [aw=partyid4]
sum ldToneW5rev if sample==1 [aw=partyid4]
sum labToneW5rev if sample==1 [aw=partyid4]
sum snpToneW5rev if sample==1 [aw=partyid4]
*by party ID
fre partyid4
*conservatives
sum conToneW5rev if sample==1 & partyid4==1 [iweight=regwt] 
sum ldToneW5rev if sample==1 & partyid4==1 [iweight=regwt] 
sum labToneW5rev if sample==1 & partyid4==1 [iweight=regwt] 
sum snpToneW5rev if sample==1 & partyid4==1 [iweight=regwt] 
*lib dem
sum conToneW5rev if sample==1 & partyid4==3 [iweight=regwt] 
sum ldToneW5rev if sample==1 & partyid4==3 [iweight=regwt] 
sum labToneW5rev if sample==1 & partyid4==3 [iweight=regwt] 
sum snpToneW5rev if sample==1 & partyid4==3 [iweight=regwt] 
*labour
sum conToneW5rev if sample==1 & partyid4==2 [iweight=regwt] 
sum ldToneW5rev if sample==1 & partyid4==2 [iweight=regwt] 
sum labToneW5rev if sample==1 & partyid4==2 [iweight=regwt] 
sum snpToneW5rev if sample==1 & partyid4==2 [iweight=regwt] 
*snp
sum conToneW5rev if sample==1 & partyid4==4 [iweight=regwt] 
sum ldToneW5rev if sample==1 & partyid4==4 [iweight=regwt] 
sum labToneW5rev if sample==1 & partyid4==4 [iweight=regwt] 
sum snpToneW5rev if sample==1 & partyid4==4 [iweight=regwt] 


*Table A4. Single parties’ perceived campaign tone and party identification
recode partyid4 (2/4=0) (1=1 "CON pid"), gen(conid)
recode partyid4 (1 2 4=0) (3=1 "LibDem pid"), gen(ldid)
recode partyid4 (1 3 4=0) (2=1 "LAB pid"), gen(labid)
recode partyid4 (0/3=0) (4=1 "SNP pid"), gen(snpid)
qui reg conToneW5rev ldToneW5rev labToneW5rev snpToneW5rev conid ldid labid snpid britscotdum  $covariates if country==2 [iweight=regwt]
reg conToneW5rev conid ldid labid snpid britscotdum  $covariates if country==2 & e(sample) [iweight=regwt]
reg ldToneW5rev conid ldid labid snpid britscotdum  $covariates if country==2 & e(sample) [iweight=regwt]
reg labToneW5rev conid ldid labid snpid britscotdum  $covariates if country==2 & e(sample) [iweight=regwt]
reg snpToneW5rev conid ldid labid snpid britscotdum  $covariates if country==2 & e(sample) [iweight=regwt]


*Table A5. Perceived negativity and vote among young people
mlogit vote4 c.perc_neg##i.id_britscot i.partyid4 if country==2 & (ageGroup==2 | ageGroup==3) [iweight=regwt], b(4)




